# Contributor: Leo <thinkabit.ukim@gmail.com>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=gpgme
pkgver=1.13.1
pkgrel=2
pkgdesc="gnupg made easy"
url="https://www.gnupg.org/related_software/gpgme/"
arch="all"
license="LGPL-2.1-or-later GPL-3.0-or-later"
depends="gnupg"
depends_dev="qt5-qtbase-dev"
makedepends="$depends_dev python3-dev py3-setuptools swig libgpg-error-dev libassuan-dev"
subpackages="$pkgname-dev $pkgname-doc gpgmepp py3-gpgme:py3 q$pkgname $pkgname-lisp:lisp:noarch"
source="https://www.gnupg.org/ftp/gcrypt/gpgme/gpgme-$pkgver.tar.bz2
	disable-json-test.patch"

case "$CARCH" in
x86|arm*) options="!check";;
mips*)	options="!check";;
esac

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info \
		--localstatedir=/var \
		--enable-languages="cl cpp python qt"
	make
}

package() {
	make DESTDIR="$pkgdir" install
}

check() {
	make check
}

lisp() {
	mkdir -p "$subpkgdir"/usr/
	mv "$pkgdir"/usr/share "$subpkgdir"/usr/share/
}

gpgmepp() {
	pkgdesc="C++ bindings for GPGME"
	mkdir -p "$subpkgdir"/usr/lib
	mv "$pkgdir"/usr/lib/libgpgmepp.so.* "$subpkgdir"/usr/lib/
}

py3() {
	pkgdesc="Python 3 bindings for $pkgname"
	depends="$depends $pkgname python3"

	mkdir -p "$subpkgdir"/usr/lib/
	mv "$pkgdir"/usr/lib/python3* "$subpkgdir"/usr/lib/
}

qgpgme() {
	pkgdesc="Qt bindings for GPGME"
	mkdir -p "$subpkgdir"/usr/lib
	mv "$pkgdir"/usr/lib/libqgpgme.so* "$subpkgdir"/usr/lib/
}

sha512sums="11de670c6cf512508103fe67af56d9fbb2a9dda6fc6fa3cd321371bbe337c7c2c81913ca557d07187adb2a63d37ea1a44da97ab22345bbe6022c405d0cb083b8  gpgme-1.13.1.tar.bz2
3efd694a94ac8c3ddc64ccf8707f72dad2ae3f4e21eb183368d3766d1811c20c95b8784d4a96ef5c23a4a0764126041f74d8106f5e4d85763b4cbb35988ea404  disable-json-test.patch"
